<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Return all values that are enums with their enum value instead of the raw integer</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.snmp-read-mib.html">« snmp_read_mib</a></li>
      <li style="float: right;"><a href="function.snmp-set-oid-numeric-print.html">snmp_set_oid_numeric_print »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.snmp.html">SNMP 函数</a></li>
    <li>Return all values that are enums with their enum value instead of the raw integer</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.snmp-set-enum-print" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">snmp_set_enum_print</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">snmp_set_enum_print</span> &mdash; <span class="dc-title">
   Return all values that are enums with their enum value instead of the raw integer
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.snmp-set-enum-print-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>snmp_set_enum_print</strong></span>(<span class="methodparam"><span class="type">bool</span> <code class="parameter">$enable</code></span>): <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   This function toggles if snmpwalk/snmpget etc. should automatically lookup enum values
   in the MIB and return them together with their human readable string. 
  </p>
 </div>

 
 <div class="refsect1 parameters" id="refsect1-function.snmp-set-enum-print-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">enable</code></dt>

    <dd>

     <p class="para">
      As the value is interpreted as boolean by the Net-SNMP library, it can only be &quot;0&quot; or &quot;1&quot;.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.snmp-set-enum-print-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   总是返回 <strong><code>true</code></strong> 。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.snmp-set-enum-print-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4461">
    <p><strong>示例 #1 Using <span class="function"><strong>snmp_set_enum_print()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />&nbsp;snmp_set_enum_print</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br />&nbsp;echo&nbsp;</span><span style="color: #0000BB">snmpget</span><span style="color: #007700">(</span><span style="color: #DD0000">'localhost'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'public'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'IF-MIB::ifOperStatus.3'</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />&nbsp;</span><span style="color: #0000BB">snmp_set_enum_print</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br />&nbsp;echo&nbsp;</span><span style="color: #0000BB">snmpget</span><span style="color: #007700">(</span><span style="color: #DD0000">'localhost'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'public'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'IF-MIB::ifOperStatus.3'</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
  <p class="para">
   The above  would return
<div class="cdata"><pre>      
 INTEGER: up(1)
 INTEGER: 1
</pre></div>
  </p>
 </div>

 
</div></div></div></body></html>